/**
 * Created by Maibenben on 2017/5/4.
 */
$(function () {
    //进入支付页面
//跳转到本页之后读取cookie中是否有mid和token
    checkCookie();
    //倒计时显示
    var last = 900;
    var timer = setInterval(function () {
        last--;
        var m = Math.floor(last / 60);
        var s = last - m * 60;
        s = s > 9 ? s : "0" + s;
        $(".last-time").text(m + ":" + s);
    }, 1000);
    if (last <= 0) {
        clearInterval(timer);
    }
    //选择支付方式
    //console.log($(".right").find("img").attr("src"));
    var pindex;
    $('.right img').click(function () {
        $('.right img').attr('src', '../imgs/no_check.png');
        $(this).attr('src', '../imgs/check.png');
        pindex = $(this).parent().index();
    });
    $(".footer").click(function () {
        //判断是哪一种支付方式
        switch (pindex) {
            case 0:
                console.log("就诊卡支付");
                break;
            case 1:
                console.log("微信支付");
                break;
            case 2:
                console.log("银联支付");
                break;
            default :
                console.log("就诊卡支付");
                break;
        }
        //self.location.href = "../html/purchase-success.html";
    });
});